package wirex

import (
	"github.com/google/wire"
	"gorm.io/gorm"
	"kf/config"
	controller "kf/controller/mod"
	middleware "kf/middleware/mod"
	"kf/models/mod"
	"kf/pkg/mysql"
	"kf/router"
	ws "kf/ws/mod"
)

var Provider = wire.NewSet(
	mod.DaoSet,
	controller.ControllerSet,
	ws.WsSet,
	middleware.MidSet,
	mysql.ConnectMysql,
	wire.Struct(new(router.Api), "*"),
	wire.Struct(new(mod.DaoAggregate), "*"),
	wire.Struct(new(controller.ControllerAggregate), "*"),
	wire.Struct(new(ws.WsAggregate), "*"),
	wire.Struct(new(middleware.MidAggregate), "*"),
	wire.Struct(new(router.Server), "*"),
	//初始化配置
	config.InitAppConfig,
	config.NewLogger,
)

type Injector struct {
	DB                  *gorm.DB
	DaoAggregate        *mod.DaoAggregate
	ControllerAggregate *controller.ControllerAggregate
	WsAggregate         *ws.WsAggregate
	Api                 *router.Api
	MidAggregate        *middleware.MidAggregate
	Server              *router.Server
}
